package com.work.daily.stream;

import com.work.daily.stream.data.Person;

import java.util.Comparator;
import java.util.List;
import java.util.Optional;

/**
 * Stream 的聚合（max/min/count)
 *
 * @author Shengkang.Mo
 * @create 2020-11-23 16:45
 */
public class Stream_4_3 {
    public static void main(String[] args) {
        List<Person> personList = Person.initData();
        Optional<Person> max = personList.stream().max(Comparator.comparingInt(Person::getSalary));
        System.out.println("员工工资最大值：" + max.get().getSalary());
    }
}
